1. Field of the Invention
The present invention generally relates to memory activity. More particularly, the present invention provides a method, system, and computer program product for light weight memory leak detection.
2. Related Art
Memory leaks and memory misuse (e.g., fragmented heap) are very common within Java 2 Platform Enterprise Edition (J2EE) applications, and will often cause process failures and will always cause poor performance. Current solutions look at heap dumps or verbose garbage collection information in order to find memory that is not being used or reclaimed properly. Unfortunately, these solutions are very expensive, processing intensive, and usually operate on the assumption that a memory leak is already known to exist. Often, however, memory leaks are not detected until the problem is critical (e.g., an application has passed all system tests, was put in production, and has crashed for an unknown reason) and cannot be resolved cleanly. Further, it is often difficult to reproduce a memory leak that has been deemed to have caused a production failure in a test environment.
Verbose garbage collection statistics are often charted in order to determine if a memory leak was the cause of a failure. If the free memory after a garbage collection cycle is consistently decreasing, then there is a high chance of a memory leak. FIG. 1 depicts an illustrative chart 10 of free memory after a garbage collection cycle in an application with a memory leak running on a server. Although the leak is very obvious to the eye, a user would not have been aware of the memory leak until after the server crashed, unless the user was actively monitoring the data.